package com.freecloud.javabasics.thread.cyclicBarrier;

import java.util.concurrent.BrokenBarrierException;
import java.util.concurrent.CyclicBarrier;

/**
 * @Author: maomao
 * @Date: 2020-02-23 18:05
 */
public class DataImportThread extends Thread {

    private CyclicBarrier cyclicBarrier;

    private String path;

    public DataImportThread(CyclicBarrier cyclicBarrier,String path){
        this.cyclicBarrier = cyclicBarrier;
        this.path = path;
    }

    @Override
    public void run(){
        System.out.println("开始导入：" + path + "数据");

        try {
            cyclicBarrier.await();//Condition.await()
        } catch (InterruptedException e) {
            e.printStackTrace();
        } catch (BrokenBarrierException e) {
            e.printStackTrace();
        }
    }
}
